﻿# -*- coding:utf-8 -*-
#
# склад  
#
from django import forms
from django.forms import ModelForm

from sklad.models import Category, Part, Unit, Waybill, Document, DocumentReceipt, DocumentDelivery
from shm.models import Department
from sklad.widgets import CategoryWidget

class CategoryForm(ModelForm): 

    class Meta:
        model = Category
        exclude = ('user',)
        


class PartForm(ModelForm):

    category = forms.ModelChoiceField(Category.objects.select_related().all(), widget=CategoryWidget(categories=Category.objects.select_related().all()))

    class Meta:
        model = Part
        exclude = ('user',)



class DocumentForm(ModelForm):

    class Meta:
        model = Document
        exclude = ('kind', 'user', 'state',)
        
        
        
class ReceiptForm(ModelForm):
    class Meta:
        model = DocumentReceipt
        exclude = ('document',)
       
       
        
class DeliveryForm(ModelForm):
    class Meta:
        model = DocumentDelivery
        exclude = ('document',)
        


 